package com.isorf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.isorf.mapper.usermapper;
import com.isorf.pojo.users;
import com.isorf.service.userservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userserviceimpl implements userservice {
    @Autowired
    private usermapper usermapper;


    @Override
    public List<users> userList() {
        return usermapper.userList();
    }

    @Override
    public int updateDisable(int id) {
        return usermapper.updateDisable(id);
    }

    @Override
    public PageInfo<users> pageList(int pageNum, int pageSize) {
        // 使用PageHelper.startPage方法设置分页参数
        PageHelper.startPage(pageNum, pageSize);
        // 查询所有用户数据，此时查询会被自动分页
        List<users> userList = usermapper.pageList();
        // 使用PageInfo包装查询结果，便于页面使用
        return new PageInfo<>(userList);
    }


}
